<?php
include_once("Database.class.php");
include_once("DFile.class.php");
include_once("logging.php");
include_once("helper.php");

class Message {
    // singleton.
    private static $instance = null;
    public static function getInstance() {
        if (self::$instance == null) {
            self::$instance = new Message();
        }
        return self::$instance;
    }
	
	public function create($data) {
		$db  = Database::getInstance();
		$res = $db->msg_create($data);
		return $res;
    }
	
	public function checkmsg($userid) {
		$db  = Database::getInstance();
		$res = $db->msg_checkmsg($userid);
		return $res;
    }			
	
	public function readonemsg($msgid) {
		$db  = Database::getInstance();
		$res = $db->msg_readonemsg($msgid);
		return $res;
    }		
	
	public function getmsglist($userid,$startnum,$showtime) {
		$db  = Database::getInstance();
		$res = $db->msg_getmsglist($userid,$startnum,$showtime);
		return $res;
    }	
	
	public function readallmsg($userid) {
		$db  = Database::getInstance();
		$res = $db->msg_readallmsg($userid);
		return $res;
    }		
	
}
?>